package Air_war;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
//图片类
public class Images {
    //公开的  静态的  图片的基本类型
    public static BufferedImage sky;//天空图片
    public static BufferedImage bullet;//子弹图片
    public static BufferedImage[] heros;//英雄机图片
    public static BufferedImage[] airs;//小敌机
    public static BufferedImage[] bairs;//大敌机
    public static BufferedImage[] bees;//小蜜蜂

    public static BufferedImage start;//启动图
    public static BufferedImage pause;//暂停图
    public static BufferedImage gameover;//游戏结束图片
    //静态块
    static {
        start = readImage("start.png");//启动图片
        pause = readImage("pause.png");//暂停图片
        gameover = readImage("gameover.png");//游戏结束图片


        sky = readImage("background.png");//天空
        bullet = readImage("bullet.png");//子弹
        heros =new BufferedImage[2];//英雄机
        heros[0] = readImage("hero0.png");
        heros[1] = readImage("hero1.png");

        airs = new BufferedImage[5];//小敌机
        bairs = new BufferedImage[5];//大敌机
        bees = new BufferedImage[5];//小密封
        airs[0] = readImage("airplane.png");//创建敌机图片数组
        bairs[0] = readImage("bigairplane.png");
        bees[0] = readImage("bee.png");
        for (int i = 1; i <airs.length ; i++) {//遍历敌人  赋值爆炸图片
            airs[i] = readImage("bom"+i+".png");
            bairs[i] = readImage("bom"+i+".png");
            bees[i] = readImage("bom"+i+".png");
        }


    }
        //图片读取
    private static BufferedImage readImage(String fileName) {
        try {//读取到img里面    读取同一个包的
            BufferedImage img = ImageIO.read(FlyingObject.class.getResource(fileName));
            return img;
        }catch (Exception e){
            e.printStackTrace();
            throw new RuntimeException();
        }
    }

    public static void main(String[] args) {
        System.out.println(Images.heros.length);
    }
}
